class Solution {
    public int firstUniqChar(String s) {
        int[] array = new int[26];
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            array[ch - 'a']++;
        }
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            if (array[ch - 'a'] == 1) {
                return i;
            }
        }
        return -1;
    }
}

public class Test {
    public static void main(String[] args) {
        String str1 = "abcd";
        String str2 = "Abcd";
        System.out.println(str1.compareToIgnoreCase(str2));
    }
}
